package com.zhijian.wharf.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author HCG
 * @version 1.0
 * @date 2022/5/18
 */
@AllArgsConstructor
@Getter
public enum StatusEnum {

    NORMAL(1, "正常"),
    CANCEL(0, "停用"),;

    private Integer code;
    private String desc;

    public static StatusEnum getByCode(Integer code) {
        StatusEnum[] values = StatusEnum.values();
        for (StatusEnum anEnum : values) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return null;
    }
}
